# -*- coding: utf-8 -*-
import json

import pymysql
import requests, pytest

from common.gol import dohkoUrl2, get_printDev

tt= [1631,85636,10000077,77,88368,85783,10000034,10000079,100000956,100000470,100000496,100000440,86708,100000552,1570,87489,100000750,100000706,100000947,85622,100000578,10000069,442,100000272,88047,100000957,100000775,100000630,100001279,100001166,100001294,86669,100001378,100001369,87540,100001572,100000621,100001552,100001619,100001643,100001599,100001651,100001719,100001741,100001753,100001745,100001703,100001822,87833,100001638,100000278,132]
new_data = []
j = 0
for i in tt:
    j = j+1
    print(j, ":", i)
    new_data.append(i)
print(tt)
print(new_data)


def test():
    userUrl = "https://dohko.login.internal.tiaofangzi.com/logOnDynamicCodeMobile"
    parm = {
        "phoneNumber": "13144444444",
        "dynamicCode": "000000",
        "plat": "1",
    }
    return_token = requests.post(userUrl, params=parm)
    user_token = "access_token=" + return_token.json()["data"]["access_token"]
    print("---------------", user_token)
    post_header = {
        "content-type": "application/json",
        "Cookie": user_token
    }
    url = dohkoUrl2 + "/basic/costOrderMaster/costOrderPay"
    body = {
        "reviewStatus": 3,
        "reviewEmpID": "100001378",
        "costOrderID": "12965"
    }
    get_printDev(requests.get(url, headers=post_header, data=json.dumps(body)))

test()



















# for i in tt:
#     new_data.append(int(i))
#     sorted(new_data)
#     new_data.sort()
# print(new_data)
# with open ('C:/Users/zhouk/Desktop/测试数据/员工id.txt','w+') as file1:
#     for j in new_data:
#         file1.write(str(j) + "\n")



# url = "https://dohko-api-hllopen.tiaofangzi.com/hllopen/api/tool-service/v1/tool/map/reverseGeocodingImproved.do?token=b091b3723eb542ebb2bc65c64f73ee63&grant_type=refresh_token&app_key=HLL_ONCALL_FE"
#
# payload = "{\"address\":\"北京市朝阳区首开广场一百二十八一百二十八一百二十八一百二十八一百二十八一百二十八一百二十八请问一百问请群翁二\"} "
# headers = {
#   'Content-Type': 'application/javascript'
# }
#
# response = requests.request("POST", url, headers=headers, data=payload)
#
# print(response.text)


# import requests
# import json
#
# url = "https://dohko.nonauth.mis.tiaofangzi.com/api/data/auth/queryDataAuth"
#
# payload = json.dumps({
#   "businessTypeID": 340,
#   "empID": 100001749,
#   "type": "2",
#   "isReturnOrgIDs": "1",
#   "isReturnEmpIDs": "1",
#   "isReturnOrgPaths": "1"
# })
# headers = {
#   'Content-Type': 'application/json'
# }
#
# response = requests.request("POST", url, headers=headers, data=payload)
#
# print(response.text)

def quick(qlist):
    if qlist == []:
        return qlist
    else:
        print("else:")
        lq = qlist[0]
        lz = quick([l for l in qlist[1: ] if l < lq])
        ly = quick([m for m in qlist[1: ] if m >= lq])
        return lz + [lq] + ly

print(quick([3, 1, 23, 5, 23]))

def fib(n):
    if n < 2:
        return n
    return fib(n-2) + fib((n-1))

print(fib(3))

# fib = lambda x:x if x < 2 else fib(x-1) + fib(x-2)

def fib(n):
    a, b = 1, 1
    if n < 3:
        return b
    for _ in range(3, n):
        a, b = b, a+b
        return b



test_dbinfo = {
    "host": "dohko.mysql.001.master.hualala.com",
    "user": "root",
    "password": "hualaladev",
    "port": 3306
}

def mysql(self, db_cof, database="db_mis"):
    """打开数据库连接"""
    self.db_cof = db_cof
    self.db = pymysql.connect(database=database, cursorclass=pymysql.cursors.DictCursor, **db_cof)
    self.cursor = self.db.cursor()

mysql()



